package ui.activity.profit.biz;

import java.util.List;

import Bean.RateLevelBean;
import Bean.UpdateBean;
import base.BaseBiz;
import base.BaseResp;
import coom.BaseSubscribe;
import coom.RetrofitHelp;
import okhttp3.RequestBody;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
import ui.activity.poscontrol.beanmodel.PosAuthRecordBean;
import ui.model.GetShareIamgeBean;
import ui.model.ProfitBean;
import ui.model.ProfitCrahBean;
import ui.model.ProfitExpandBean;
import ui.model.ProfitNewBean;
import ui.model.ProfitpromotionBean;
import ui.model.TodyBean;

/**
 * Created by chenjian on 19/2/26.
 * 1
 */

public class ProfitBiz extends BaseBiz {

    /**
     * 获取当日收益
     */
    public void GetInComeDetail(String customId, String strDate,  final Callback<ProfitBean> callback) {
        com.add(RetrofitHelp.getSecretApi().trans_detail(customId, strDate)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<ProfitBean>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((ProfitBean) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((ProfitBean) obj);
                    }
                })
        );
    }
    /**
     * 获取当日收益
     */
    public void GetInComeDetailNew(int year, int month,int day,  final Callback<ProfitNewBean> callback) {
        com.add(RetrofitHelp.getSecretApi().queryTodayMoneyInfo(year,month,day)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<ProfitNewBean>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((ProfitNewBean) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((ProfitNewBean) obj);
                    }
                })
        );
    }
    /**
     * 获取当日收益激活返现收益
     */
    public void GetInComeDetailCrah(int year, int month,int day,int page,int size ,final Callback<ProfitCrahBean> callback) {
        com.add(RetrofitHelp.getSecretApi().queryTodayMoneycash(year,month,day,page,size)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<ProfitCrahBean>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((ProfitCrahBean) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((ProfitCrahBean) obj);
                    }
                })
        );
    }
    /**
     * 获取当日收益拓展奖励
     */
    public void GetInComeDetailExpand(int year, int month, int day, int page, int size , final Callback<ProfitExpandBean> callback) {
        com.add(RetrofitHelp.getSecretApi().queryTodayMoneyexpand(year,month,day,page,size)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<ProfitExpandBean>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((ProfitExpandBean) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((ProfitExpandBean) obj);
                    }
                })
        );
    }
    /**
     * 获取当日收益拓展奖励
     */
    public void GetInComeDetailPromotion(int year, int month, int day, int page, int size , final Callback<ProfitpromotionBean> callback) {
        com.add(RetrofitHelp.getSecretApi().queryTodayMoneypromotion(year,month,day,page,size)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<ProfitpromotionBean>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((ProfitpromotionBean) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((ProfitpromotionBean) obj);
                    }
                })
        );
    }
    /**
     * 定向划拨
     */
    public void Directionalallocation(RequestBody requestBody, final Callback<Boolean> callback) {
        com.add(RetrofitHelp.getSecretApi().directionalallocation(requestBody)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<Boolean>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((Boolean) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((Boolean) obj);
                    }
                })
        );
    }
    /**
     * 定向划拨
     */
    public void flowliuzhuan(RequestBody requestBody, final Callback<Boolean> callback) {
        com.add(RetrofitHelp.getSecretApi().flowliuzhuan(requestBody)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<Boolean>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((Boolean) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((Boolean) obj);
                    }
                })
        );
    }
    /**
     * 获取用户等级
     */
    public void GetUserRate(String customid, final Callback<RateLevelBean> callback) {
        com.add(RetrofitHelp.getSecretApi().getUserRate(customid,1)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<RateLevelBean>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((RateLevelBean) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((RateLevelBean) obj);
                    }
                })
        );
    }
    /**
     * 获取用户等级2
     */
    public void GetUserRate2( final Callback<List<String>> callback) {
        com.add(RetrofitHelp.getSecretApi().getRate()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<List<String>>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((List<String>) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((List<String>) obj);
                    }
                })
        );
    }
    /**
     * 自助报单
     */
    public void AddSimplePOS(RequestBody requestBody, final Callback<Object> callback) {
        com.add(RetrofitHelp.getSecretApi().addSimplePOS(requestBody)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<Object>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess(obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure(obj);
                    }
                })
        );
    }
    /**
     * 自助报单
     */
    public void GetShareImage(RequestBody requestBody, final Callback<GetShareIamgeBean> callback) {
        com.add(RetrofitHelp.getSecretApi().GetShareIamgeBean(requestBody)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<GetShareIamgeBean>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((GetShareIamgeBean)obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((GetShareIamgeBean)obj);
                    }
                })
        );
    }

    /**
     * 获取自助报单记录
     */
    public void GetPosAuthRecord( int page, int size , final Callback<PosAuthRecordBean> callback) {
        com.add(RetrofitHelp.getSecretApi().queryPosAuthRecord(page,size)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<PosAuthRecordBean>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((PosAuthRecordBean) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((PosAuthRecordBean) obj);
                    }
                })
        );
    }
    /**
     * 获取自助报单记录
     */
    public void GetTodyInfo(final Callback<List<TodyBean>> callback) {
        com.add(RetrofitHelp.getSecretApi().gettody()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<List<TodyBean>>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((List<TodyBean>) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((List<TodyBean>) obj);
                    }
                })
        );
    }
    /**
     * 登出接口
     */
    public void logout(final Callback<String> callback) {
        com.add(RetrofitHelp.getSecretApi().logout()
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<String>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((String) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((String) obj);
                    }
                })
        );
    }
    /**
     * 获取版本更新
     */
    public void updateversion(String url,final Callback<UpdateBean> callback) {
        com.add(RetrofitHelp.getSecretApi().UpdateVersion(url)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe<BaseResp<UpdateBean>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((UpdateBean) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((UpdateBean) obj);
                    }
                })
        );
    }

}
